<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: zhang_yao_wu1993
  Date: 15/4/21
  Time: 下午10:33
--%>
<!DOCTYPE html>
<html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<head>
    <title>ZeRur</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script type="text/javascript" src="/Other/Lib/jquery-2.1.3.js"></script>
    <script type="text/javascript" src="/Other/Lib/SemanticUI/dist/semantic.min.js"></script>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/button.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/label.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/menu.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/list.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/item.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/comment.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/divider.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/image.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/sticky.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/form.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/icon.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/table.min.css"/>
    <link rel="stylesheet" href="/Other/StyleSheet/blog_Manage.css"/>
</head>
<body style="background: RGBA(236, 236, 236, 1)">
<%-- header --%>
<div id="header">
    <sec:authorize access="hasAnyRole('ROLE_ADMIN','ROLE_USER')">
        <div class="ui divided horizontal list">
            <div class="item"><a href="/">欢迎页</a></div>
            <div class="item"><a href="/MainPage">主页</a></div>
            <div class="item"><a href="/MessagePage">留言</a></div>
            <div class="item"><a href="/IndividualCenter">个人中心</a></div>
            <sec:authorize access="hasRole('ROLE_ADMIN')">
                <div class="item"><a href="javascript:void(0)" style="color: white;">管理</a></div>
            </sec:authorize>
            <div class="item"><a onclick="logout()">登出</a></div>
            <form action="/j_logout" method="post">
                <input type="hidden"
                       name="${_csrf.parameterName}"
                       value="${_csrf.token}"/>
            </form>
            <script>
                function logout() {
                    $("#header div form").submit();
                }
            </script>
        </div>
    </sec:authorize>
    <sec:authorize access="isAnonymous()">
        <div class="ui divided horizontal list">
            <div class="item"><a href="/">欢迎页</a></div>
        </div>
    </sec:authorize>
</div>
<%-- end header --%>
<%-- body --%>
<div id="body">
    <%-- category manage --%>
    <div class="ui label">
        <a class="ui ribbon label teal big">类别管理</a>
        <table class="ui table">
            <thead>
            <tr>
                <th class="two wide">id</th>
                <th class="five wide">类别</th>
                <th class="two wide">文章数</th>
                <th class="two wide">删除</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach var="item" items="${blogManagePageVo.blogManagePageCategoryList}">
                <tr>
                    <td>${item.id}</td>
                    <td>${item.title}</td>
                    <td>${item.articleCount}</td>
                    <td>
                        <a class="ui basic label small" href="/DeleteCategory/${item.id}">删除</a>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>
    <%-- end category manage --%>
    <%-- article manage --%>
    <div class="ui label">
        <a class="ui ribbon label teal big">文章管理</a>
        <table class="ui table">
            <thead>
            <tr>
                <th class="two wide">id</th>
                <th class="five wide">标题</th>
                <th class="four wide">类别</th>
                <th class="two wide">预览</th>
                <th class="two wide">删除</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach var="item" items="${blogManagePageVo.blogManagePageArticleList}">
                <tr>
                    <td>${item.id}</td>
                    <td>${item.title}</td>
                    <td>${item.category}</td>
                    <td>
                        <a class="ui basic label small" href="/ArticlePage/${item.uuid}" target="_blank">预览</a>
                    </td>
                    <td>
                        <a class="ui basic label small" href="/DeleteArticle/${item.uuid}">删除</a>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
            <tfoot class="full-width">
            <tr>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td>
                    <a class="ui basic label teal" href="/UploadPage">添加</a>
                </td>
            </tr>
            </tfoot>
        </table>
    </div>
    <%-- end article manage --%>
</div>
<%-- end body --%>
<%-- footer --%>
<div id="footer">
    <span>zhang_yao_wu1993@yeah.net</span>
    <span>辽ICP备15003806号</span>
</div>
<%-- end footer --%>
<div class="clearboth"></div>
</body>
</html>
